<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="textml; charset=utf-8" />
<link href="/admins/css/adminshare.css" media="screen" rel="stylesheet" type="text/css" >    
<link href="/css/home/replacerecharge.css" media="screen" rel="stylesheet" type="text/css" >    
<script type="text/javascript" src="/js/clip/zeroclipboard.js"></script>  
<script type="text/javascript" src="/admins/js/jquery/jquery-1.7.2.min.js"></script>
<style type="text/css">
.botton span {
    background: url(/admins/images/button.jpg);
    height: 18px;
    float: left;
    padding: 9px 42px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 18px;
}
</style>
</head>
<body>
<div style="float:left;">
	<div class="home">
        <div class="home_right">
			<div class="replacerechargetab">
            	<ul>
                	<li class="tabon"><a class="tab1" href="javascript:void();"><i></i>代购推广链接</a></li>
                </ul>
            </div>
            <form action="" method="post" id="form1">
            <div class="apply" style="width:1750px;">
            	<div class="applyts">
                	<i></i>请认真填写代购推广链接
                </div>
                <div class="applytable">
                	<table>
                    	<tr>
                            <td class="z">商品详情链接：</td>
                            <td>
                            	<div class="input" style="border:0px;">
                                        <label>请粘贴商品详情链接</label>
                                        <input class="required" type="text" id="url" name="url" style="width:1450px;"/>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">广告系列：</td>
                            <td>
                            	<div class="input" style="border:0px;">
                                        <label>请输入广告系列</label>
                                        <input class="required" type="text" id="_n" name="_n"/>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">来源：</td>
                            <td>
                            	<div class="input" style="border:0px;">
                                        <label>请输入来源</label>
                                        <input class="required" type="text" id="_s" name="_s"/>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">媒介：</td>
                            <td>
                            	<div class="input" style="border:0px;">
                                        <label>请输入媒介</label>
                                        <input class="required" type="text" id="_m" name="_m"/>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">字词：</td>
                            <td>
                            	<div class="input" style="border:0px;">
                                        <label>请输入字词</label>
                                        <input class="required" type="text" id="_t" name="_t"/>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">内容：</td>
                            <td>
                            	<div class="input" style="border:0px;">
                                        <label>请输入内容</label>
                                        <input class="required" type="text" id="_c" name="_c"/>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">&nbsp;</td>
                            <td>
                            	<div class="botton" style="margin-left: 32px;width:600px;">
                                        <a href="javascript:createURL();"><span>点击生成代购链接</span></a>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">&nbsp;</td>
                            <td>
                            	<div id="purchaseURL" style="display:none;width:1200px;">
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">&nbsp;</td>
                            <td>
                            	<div style="margin-left: 120px;" class="dizhitable"><a href="#" id="d_clip_button">点击复制链接</a></div>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
            </form>
        </div>    
    </div>
</div>

<script type="text/javascript">
$('.input label').click(function(){    
    $(this).parent().find(':input').focus().click();
    $(this).val("");
});
$('.input input').keyup(function(){
    if($(this).val()===''){
        $(this).prev().show();
    }else{
        $(this).prev().hide();
    }
});

function createURL(){
    var url = $('#url').val();
    var newURL = encodeURIComponent(url);
    var _n = encodeURI($('#_n').val());
    var _s = encodeURI($('#_s').val());
    var _m = encodeURI($('#_m').val());
    var _t = encodeURI($('#_t').val());
    var _c = encodeURI($('#_c').val());
    $('#purchaseURL').show();   
    var filter  = /www\.uuch\.com/gi;
    if(filter.test(url)){
        var pre = /\?/;
        if(pre.test(url)){
            $('#purchaseURL').html(url+"&_n="+_n+"&_s="+_s+"&_m="+_m+"&_t="+_t+"&_c="+_c);
        }else{
            $('#purchaseURL').html(url+"?_n="+_n+"&_s="+_s+"&_m="+_m+"&_t="+_t+"&_c="+_c);
        }
    }else{
        $('#purchaseURL').html("http://old.uuch.com/purchase/url?"+"_n="+_n+"&_s="+_s+"&_m="+_m+"&_t="+_t+"&_c="+_c+"&url="+newURL);
    }
    $('.dizhitable').show();
    var clip = new ZeroClipboard.Client();
    ZeroClipboard.setMoviePath("/js/clip/ZeroClipboard.swf");
    clip.setHandCursor(true);
    clip.glue(d_clip_button);
    var code = $('#purchaseURL').text();
    clip.setText(code);
    clip.addEventListener('complete', function(client, text) {
        alert("已经复制到剪贴板:\n" + text);
    });
}
</script>
</body>
</html>


